package myky.com.doctorapp.model

import com.xiangyao.train.utils.RxScedulerHelper

import io.reactivex.Observable
import myky.com.doctorapp.api.ApiManager
import myky.com.doctorapp.base.BaseEntity
import myky.com.doctorapp.contract.RemoteDetailsActivityContract
import myky.com.doctorapp.entity.RemoteDetailsEntity
import myky.com.doctorapp.entity.RemoteRepeatEntity
import myky.com.doctorapp.entity.RemoteSupplyEntity
import myky.com.doctorapp.utils.RequestBodyBuilder

/**
 * Description:
 *
 * @author wuyangwuyang
 * Created by 2019/3/11 on 16:09
 */
class RemoteDetailsActivityModel : RemoteDetailsActivityContract.Model {
    override fun remoteSupply(remoteId: String,remoteSupplyEntity: RemoteSupplyEntity): Observable<BaseEntity<RemoteRepeatEntity.PayLoadBean>> {
        val requestBodyBuilder = RequestBodyBuilder.Builder()
        val requestBody=requestBodyBuilder.build(remoteSupplyEntity)
        return ApiManager.getApistore().remoteSupply(remoteId,requestBody).compose(RxScedulerHelper.io_main())
    }

    override fun remoteCancel(remoteId: String): Observable<BaseEntity<RemoteRepeatEntity.PayLoadBean>> {
        return ApiManager.getApistore().remoteCancel(remoteId).compose(RxScedulerHelper.io_main())
    }

    override fun remoteDetail(remoteId: String): Observable<BaseEntity<RemoteDetailsEntity.PayLoadBean>> {
        return ApiManager.getApistore().remoteDetail(remoteId).compose(RxScedulerHelper.io_main())
    }
}
